<html>
<head>
<meta charset="utf-8"></meta>
<title>BXmlNode</title>
<link href="./style.css" rel="stylesheet" type="text/css"/>
	</head>
<body>
		<div class="class" name="BXmlNode">
<h1>BXmlNode</h1>
<p>继承自<a href="BObject.html">BObject</a></p>
			<p id="resume"><a href="#desc">详细</a></p><h2>public</h2>
<table id="public">
<tr><td align="right"/><td><a href="#BXmlNode(BXmlNode*)">BXmlNode</a>(BXmlNode* parent = 0);</td></tr>
<tr><td align="right"/><td><a href="#BXmlNode(const BString&,BXmlNode*)">BXmlNode</a>(const BString&amp; name, BXmlNode* parent = 0);</td></tr>
<tr><td align="right"/><td><a href="#~BXmlNode()">~BXmlNode</a>();</td></tr>
<tr><td align="right">virtual void </td><td><a href="#copy(const BXmlNode*)">copy</a>(const BXmlNode* other);</td></tr>
<tr><td align="right">virtual BXmlNode* </td><td><a href="#clone() const">clone</a>() const;</td></tr>
<tr><td align="right">bool </td><td><a href="#empty() const">empty</a>() const;</td></tr>
<tr><td align="right">bool </td><td><a href="#dirty() const">dirty</a>() const;</td></tr>
<tr><td align="right">virtual bool </td><td><a href="#setFormat(const BString&)">setFormat</a>(const BString&amp; format);</td></tr>
<tr><td align="right">const BString&amp; </td><td><a href="#format() const">format</a>() const;</td></tr>
<tr><td align="right">virtual bool </td><td><a href="#setText(const BString&)">setText</a>(const BString&amp; text);</td></tr>
<tr><td align="right">const BString&amp; </td><td><a href="#text() const">text</a>() const;</td></tr>
<tr><td align="right">void </td><td><a href="#appendText(const BString&)">appendText</a>(const BString&amp; text);</td></tr>
<tr><td align="right">void </td><td><a href="#prependText(const BString&)">prependText</a>(const BString&amp; text);</td></tr>
<tr><td align="right">const BString&amp; </td><td><a href="#plainText() const">plainText</a>() const;</td></tr>
<tr><td align="right">virtual void </td><td><a href="#setAttribMap(const, BString>&)">setAttribMap</a>(const BMap&lt;BString, BString&gt;&amp; attribMap);</td></tr>
<tr><td align="right">const BMap&lt;BString, BString&gt;&amp; </td><td><a href="#attribMap() const">attribMap</a>() const;</td></tr>
<tr><td align="right">virtual bool </td><td><a href="#setAttrib(const BString&, const BString&)">setAttrib</a>(const BString&amp; name, const BString&amp; value);</td></tr>
<tr><td align="right">const BString&amp; </td><td><a href="#attrib(const BString&) const">attrib</a>(const BString&amp; name) const;</td></tr>
<tr><td align="right">bool </td><td><a href="#containAttrib(const BString&) const">containAttrib</a>(const BString&amp; name) const;</td></tr>
<tr><td align="right">virtual bool </td><td><a href="#removeAttrib(const BString&)">removeAttrib</a>(const BString&amp; name);</td></tr>
<tr><td align="right">virtual bool </td><td><a href="#clearAttribs()">clearAttribs</a>();</td></tr>
<tr><td align="right">const BXmlDocument* </td><td><a href="#document() const">document</a>() const;</td></tr>
<tr><td align="right">BXmlDocument* </td><td><a href="#document()">document</a>();</td></tr>
<tr><td align="right">const BXmlNode* </td><td><a href="#root() const">root</a>() const;</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#root()">root</a>();</td></tr>
<tr><td align="right">void </td><td><a href="#setParent(BXmlNode*)">setParent</a>(BXmlNode* parent);</td></tr>
<tr><td align="right">const BXmlNode* </td><td><a href="#parent() const">parent</a>() const;</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#parent()">parent</a>();</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#parent(const BString&)">parent</a>(const BString&amp; name);</td></tr>
<tr><td align="right">const BXmlNode* </td><td><a href="#parent(const BString&) const">parent</a>(const BString&amp; name) const;</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#addText(const BString&)">addText</a>(const BString&amp; text);</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#addChild(const BString&,const BString&)">addChild</a>(const BString&amp; name, const BString&amp; text = BString());</td></tr>
<tr><td align="right">bool </td><td><a href="#addChild(BXmlNode*)">addChild</a>(BXmlNode* child);</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#insertText(int, const BString&)">insertText</a>(int pos, const BString&amp; text);</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#insertChild(int, const BString&,const BString&)">insertChild</a>(int pos, const BString&amp; name, const BString&amp; text = BString());</td></tr>
<tr><td align="right">bool </td><td><a href="#insertChild(int, BXmlNode*)">insertChild</a>(int pos, BXmlNode* child);</td></tr>
<tr><td align="right">bool </td><td><a href="#replaceChild(BXmlNode*, BXmlNode*)">replaceChild</a>(BXmlNode* child, BXmlNode* node);</td></tr>
<tr><td align="right">bool </td><td><a href="#removeChild(int)">removeChild</a>(int pos);</td></tr>
<tr><td align="right">bool </td><td><a href="#removeChild(const BString&)">removeChild</a>(const BString&amp; name);</td></tr>
<tr><td align="right">bool </td><td><a href="#removeChild(const BXmlNode*)">removeChild</a>(const BXmlNode* node);</td></tr>
<tr><td align="right">virtual bool </td><td><a href="#clearChildren()">clearChildren</a>();</td></tr>
<tr><td align="right">int </td><td><a href="#childCount() const">childCount</a>() const;</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#child(int)">child</a>(int index);</td></tr>
<tr><td align="right">const BXmlNode* </td><td><a href="#child(int) const">child</a>(int index) const;</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#child(const BString&)">child</a>(const BString&amp; desc);</td></tr>
<tr><td align="right">const BXmlNode* </td><td><a href="#child(const BString&) const">child</a>(const BString&amp; desc) const;</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#find(const BString&)">find</a>(const BString&amp; desc);</td></tr>
<tr><td align="right">const BXmlNode* </td><td><a href="#find(const BString&) const">find</a>(const BString&amp; desc) const;</td></tr>
<tr><td align="right">int </td><td><a href="#level() const">level</a>() const;</td></tr>
<tr><td align="right">bool </td><td><a href="#setIndex(int)">setIndex</a>(int index);</td></tr>
<tr><td align="right">int </td><td><a href="#index() const">index</a>() const;</td></tr>
<tr><td align="right">bool </td><td><a href="#raise()">raise</a>();</td></tr>
<tr><td align="right">bool </td><td><a href="#lower()">lower</a>();</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#prev()">prev</a>();</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#next()">next</a>();</td></tr>
<tr><td align="right">bool </td><td><a href="#above(const BXmlNode*) const">above</a>(const BXmlNode* node) const;</td></tr>
<tr><td align="right">bool </td><td><a href="#under(const BXmlNode*) const">under</a>(const BXmlNode* node) const;</td></tr>
<tr><td align="right">bool </td><td><a href="#contain(const BXmlNode*) const">contain</a>(const BXmlNode* node) const;</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#create(const BString&)">create</a>(const BString&amp; path);</td></tr>
<tr><td align="right">BXmlNode* </td><td><a href="#locate(const BString&)">locate</a>(const BString&amp; desc);</td></tr>
<tr><td align="right">const BXmlNode* </td><td><a href="#locate(const BString&) const">locate</a>(const BString&amp; desc) const;</td></tr>
<tr><td align="right">bool </td><td><a href="#collect(const BString&, BArray<BXmlNode*>&)">collect</a>(const BString&amp; desc, BArray&lt;BXmlNode*&gt;&amp; result);</td></tr>
<tr><td align="right">bool </td><td><a href="#collect(const BString&, BArray<const BXmlNode*>&) const">collect</a>(const BString&amp; desc, BArray&lt;const BXmlNode*&gt;&amp; result) const;</td></tr>
<tr><td align="right">BArray&lt;BXmlNode*&gt; </td><td><a href="#collect(const BString&)">collect</a>(const BString&amp; desc);</td></tr>
<tr><td align="right">BArray&lt;const BXmlNode*&gt; </td><td><a href="#collect(const BString&) const">collect</a>(const BString&amp; desc) const;</td></tr>
<tr><td align="right">BString </td><td><a href="#path(const char*) const">path</a>(const char* split = "/") const;</td></tr>
<tr><td align="right">BString </td><td><a href="#path(const BString&) const">path</a>(const BString&amp; split) const;</td></tr>
<tr><td align="right">BString </td><td><a href="#pathTo(const BXmlNode*,const char*) const">pathTo</a>(const BXmlNode* parent, const char* split = "/") const;</td></tr>
<tr><td align="right">BString </td><td><a href="#pathTo(const BXmlNode*, const BString&) const">pathTo</a>(const BXmlNode* parent, const BString&amp; split) const;</td></tr>
			</table>
<div id="desc">
<h2>详细介绍：</h2>
				<p>BXmlNode是XML文档的节点对象，其可有一个父节点和多个子节点，另外还可拥有若干属性值和文档格式描述。如果其名称为空则表示这是一个文本节点。如果名称为感叹号'!'表示此节点是注释节点。</p><p>文档格式描述是一个字符串，用于指示在写出为文本时如何进行格式化。如"\n&lt;&gt;\n&lt;/&gt;\n" 表示在节点开始前进行换行，在节点开头之后也添加换行符，在节点结束之前进行换行，在节点结束之后也进行换行。</p>
				<p>使用方法prev()和next()可以分别得到当前节点的前一个节点和后一个节点。可以通过描述寻找到子节点，如: "name:id=top@index#abc" 表示寻找一个节点其名称为name，并且其文本包含文本index但不包含abc。</p>
				<p><a href="./BXmlDocument.html">BXmlDocument</a><text>可用于从文本或文件中读取节点数据。</text><br/></p>
			</div>
<h2 id="docs">成员文档：</h2>
<div id="BXmlNode(BXmlNode*)">
<h3>BXmlNode(BXmlNode* parent = 0);</h3>
				<p>Constructs xml node with parent.</p>
			</div>
<div id="BXmlNode(const BString&,BXmlNode*)">
<h3>BXmlNode(const BString&amp; name, BXmlNode* parent = 0);</h3>
				<p>Constructs xml node with name and parent.</p>
			</div>
<div id="~BXmlNode()">
<h3>~BXmlNode();</h3>
				<p>Destroys xml node.</p>
			</div>
<div id="copy(const BXmlNode*)">
<h3>virtual void copy(const BXmlNode* other);</h3>
			</div>
<div id="clone() const">
<h3>virtual BXmlNode* clone() const;</h3>
			</div>
<div id="empty() const">
<h3>bool empty() const;</h3>
			</div>
<div id="dirty() const">
<h3>bool dirty() const;</h3>
			</div>
<div id="setFormat(const BString&)">
<h3>virtual bool setFormat(const BString&amp; format);</h3>
				<p>设置此节点的格式字符串，将从格式文本中解析出此节点在写出为文档时的格式。</p><p>格式解析是按下表的特征逐个识别：</p><table>
					<tr><td>&lt;/</td><td>若发现此特征，则其前面的字符为结尾的前置字符。<br/>此特征还标示了此节点的结尾独立而不使用缩略模式，如&lt;br&gt;&lt;/br&gt;。</td></tr>
					<tr><td>/&gt;</td><td>若发现此特征，则其后面的字符为结尾的后置字符。</td></tr>
					<tr><td>&gt;</td><td>若发现此特征，则其后面的字符为头部的后置字符。</td></tr>
					<tr><td>&lt;</td><td>若发现此特征，则其前面的字符为头部的前置字符。</td></tr>
					<tr><td>#</td><td>此特征称为文本特征，其后的字符为文本后置字符。</td></tr></table><p>注意：识别出的格式字符只有换行是有意义的，使用转义写法。<br/>例如：\n&lt;&gt; #\n&lt;/&gt;，表示头部开始前换行，文本结束处换行，结尾开始前换行。</p>
			</div>
<div id="format() const">
<h3>const BString&amp; format() const;</h3>
			</div>
<div id="setText(const BString&)">
<h3>virtual bool setText(const BString&amp; text);</h3>
			</div>
<div id="text() const">
<h3>const BString&amp; text() const;</h3>
			</div>
<div id="appendText(const BString&)">
<h3>void appendText(const BString&amp; text);</h3>
			</div>
<div id="prependText(const BString&)">
<h3>void prependText(const BString&amp; text);</h3>
			</div>
<div id="plainText() const">
<h3>const BString&amp; plainText() const;</h3>
			</div>
<div id="setAttribMap(const, BString>&)">
<h3>virtual void setAttribMap(const BMap&lt;BString, BString&gt;&amp; attribMap);</h3>
			</div>
<div id="attribMap() const">
<h3>const BMap&lt;BString, BString&gt;&amp; attribMap() const;</h3>
			</div>
<div id="setAttrib(const BString&, const BString&)">
<h3>virtual bool setAttrib(const BString&amp; name, const BString&amp; value);</h3>
			</div>
<div id="attrib(const BString&) const">
<h3>const BString&amp; attrib(const BString&amp; name) const;</h3>
			</div>
<div id="containAttrib(const BString&) const">
<h3>bool containAttrib(const BString&amp; name) const;</h3>
			</div>
<div id="removeAttrib(const BString&)">
<h3>virtual bool removeAttrib(const BString&amp; name);</h3>
				<p>Remove node's attrib of name.</p>
			</div>
<div id="clearAttribs()">
<h3>virtual bool clearAttribs();</h3>
			</div>
<div id="document() const">
<h3>const BXmlDocument* document() const;</h3>
			</div>
<div id="document()">
<h3>BXmlDocument* document();</h3>
			</div>
<div id="root() const">
<h3>const BXmlNode* root() const;</h3>
			</div>
<div id="root()">
<h3>BXmlNode* root();</h3>
				<p>Get the root node of this one.</p>
			</div>
<div id="setParent(BXmlNode*)">
<h3>void setParent(BXmlNode* parent);</h3>
			</div>
<div id="parent() const">
<h3>const BXmlNode* parent() const;</h3>
			</div>
<div id="parent()">
<h3>BXmlNode* parent();</h3>
			</div>
<div id="parent(const BString&)">
<h3>BXmlNode* parent(const BString&amp; name);</h3>
			</div>
<div id="parent(const BString&) const">
<h3>const BXmlNode* parent(const BString&amp; name) const;</h3>
			</div>
<div id="addText(const BString&)">
<h3>BXmlNode* addText(const BString&amp; text);</h3>
			</div>
<div id="addChild(const BString&,const BString&)">
<h3>BXmlNode* addChild(const BString&amp; name, const BString&amp; text = BString());</h3>
			</div>
<div id="addChild(BXmlNode*)">
<h3>bool addChild(BXmlNode* child);</h3>
				<p>Append a child node.</p>
			</div>
<div id="insertText(int, const BString&)">
<h3>BXmlNode* insertText(int pos, const BString&amp; text);</h3>
			</div>
<div id="insertChild(int, const BString&,const BString&)">
<h3>BXmlNode* insertChild(int pos, const BString&amp; name, const BString&amp; text = BString());</h3>
			</div>
<div id="insertChild(int, BXmlNode*)">
<h3>bool insertChild(int pos, BXmlNode* child);</h3>
			</div>
<div id="replaceChild(BXmlNode*, BXmlNode*)">
<h3>bool replaceChild(BXmlNode* child, BXmlNode* node);</h3>
			</div>
<div id="removeChild(int)">
<h3>bool removeChild(int pos);</h3>
			</div>
<div id="removeChild(const BString&)">
<h3>bool removeChild(const BString&amp; name);</h3>
			</div>
<div id="removeChild(const BXmlNode*)">
<h3>bool removeChild(const BXmlNode* node);</h3>
			</div>
<div id="clearChildren()">
<h3>virtual bool clearChildren();</h3>
			</div>
<div id="childCount() const">
<h3>int childCount() const;</h3>
			</div>
<div id="child(int)">
<h3>BXmlNode* child(int index);</h3>
			</div>
<div id="child(int) const">
<h3>const BXmlNode* child(int index) const;</h3>
			</div>
<div id="child(const BString&)">
<h3>BXmlNode* child(const BString&amp; desc);</h3>
				<p>Find child matchs the desc text.The desc text only describes one node.</p>
			</div>
<div id="child(const BString&) const">
<h3>const BXmlNode* child(const BString&amp; desc) const;</h3>
			</div>
<div id="find(const BString&)">
<h3>BXmlNode* find(const BString&amp; desc);</h3>
				<p>Find lower node macths the desc text.The desc only describes one node.</p>
			</div>
<div id="find(const BString&) const">
<h3>const BXmlNode* find(const BString&amp; desc) const;</h3>
			</div>
<div id="level() const">
<h3>int level() const;</h3>
			</div>
<div id="setIndex(int)">
<h3>bool setIndex(int index);</h3>
			</div>
<div id="index() const">
<h3>int index() const;</h3>
			</div>
<div id="raise()">
<h3>bool raise();</h3>
			</div>
<div id="lower()">
<h3>bool lower();</h3>
			</div>
<div id="prev()">
<h3>BXmlNode* prev();</h3>
				<p>Return the brother node before this one.</p>
			</div>
<div id="next()">
<h3>BXmlNode* next();</h3>
				<p>Return the brother node after this one.</p>
			</div>
<div id="above(const BXmlNode*) const">
<h3>bool above(const BXmlNode* node) const;</h3>
			</div>
<div id="under(const BXmlNode*) const">
<h3>bool under(const BXmlNode* node) const;</h3>
			</div>
<div id="contain(const BXmlNode*) const">
<h3>bool contain(const BXmlNode* node) const;</h3>
			</div>
<div id="create(const BString&)">
<h3>BXmlNode* create(const BString&amp; path);</h3>
			</div>
<div id="locate(const BString&)">
<h3>BXmlNode* locate(const BString&amp; desc);</h3>
				<p>Find node matchs the desc text, the desc is layered by '/',each level find each node's children.Eg: "body/div:id=#123/p:id=title" means find node named "body", if success then try to find node which's name is "div" and attrib "id" is "123" in body node, if still success then find node which's name is "id" and attrib "id" is "title" in div node.</p>
			</div>
<div id="locate(const BString&) const">
<h3>const BXmlNode* locate(const BString&amp; desc) const;</h3>
			</div>
<div id="collect(const BString&, BArray<BXmlNode*>&)">
<h3>bool collect(const BString&amp; desc, BArray&lt;BXmlNode*&gt;&amp; result);</h3>
			</div>
<div id="collect(const BString&, BArray<const BXmlNode*>&) const">
<h3>bool collect(const BString&amp; desc, BArray&lt;const BXmlNode*&gt;&amp; result) const;</h3>
			</div>
<div id="collect(const BString&)">
<h3>BArray&lt;BXmlNode*&gt; collect(const BString&amp; desc);</h3>
			</div>
<div id="collect(const BString&) const">
<h3>BArray&lt;const BXmlNode*&gt; collect(const BString&amp; desc) const;</h3>
			</div>
<div id="path(const char*) const">
<h3>BString path(const char* split = "/") const;</h3>
			</div>
<div id="path(const BString&) const">
<h3>BString path(const BString&amp; split) const;</h3>
			</div>
<div id="pathTo(const BXmlNode*,const char*) const">
<h3>BString pathTo(const BXmlNode* parent, const char* split = "/") const;</h3>
			</div>
<div id="pathTo(const BXmlNode*, const BString&) const">
<h3>BString pathTo(const BXmlNode* parent, const BString&amp; split) const;</h3>
			</div>
		</div>
	</body>
</html>